package com.baozun.houji.me.fragment

import android.os.Bundle
import android.view.View
import androidx.fragment.app.Fragment
import androidx.viewpager.widget.ViewPager
import com.baozhun.mall.common.base.BaseFragment
import com.baozun.houji.me.databinding.FragmentMessageBinding
import com.baozun.houji.me.model.enums.MessageType
import com.baozun.houji.me.viewmodel.MessageViewModel
import com.jaeger.library.StatusBarUtil

/**
 * @Title：消息Fragment
 * @Description：
 * @Author：xuefeng.zhu
 * @Since：2022/11/4
 * @Version：1.0.0
 */
class MessageFragment : BaseFragment<MessageViewModel, FragmentMessageBinding>(),
    ViewPager.OnPageChangeListener {

    /**
     * 消息tab
     */
    private val mTabFragmentList = arrayListOf<Fragment>(
        SystemMsgFragment.newInstance(),
        ChatFragment.newInstance(),
    )

    override fun initView(savedInstanceState: Bundle?) {
        StatusBarUtil.setTransparentForImageView(mActivity, mDataBinding.tabLayout)
        StatusBarUtil.setLightMode(mActivity)
        mDataBinding.tabLayout.setViewPager(
            mDataBinding.viewpager,
            arrayOf(MessageType.SYSTEM_MSG.type, MessageType.CUSTOMER_MSG.type),
            mActivity,
            mTabFragmentList
        )
        mDataBinding.viewpager.addOnPageChangeListener(this)
    }

    override fun onClick(v: View?) {
        super.onClick(v)
        when (v?.id) {


        }
    }

    /**
     * 懒加载
     */
    override fun lazyLoadData() {
    }

    override fun createObserver() {
    }

    override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
    }

    override fun onPageSelected(position: Int) {
    }

    override fun onPageScrollStateChanged(state: Int) {
    }
}